//
//  SISSShowSixInfoView.m
//  SISSAPP
//
//  Created by 袁应荣 on 2017/10/17.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSShowSixInfoView.h"

@interface SISSShowSixInfoView ()

// firstLabel
@property (weak, nonatomic) UILabel *firstLabel;
@property (weak, nonatomic) UILabel *firstTitleLabel;
/// secondLabel
@property (weak, nonatomic) UILabel *secondLabel;
@property (weak, nonatomic) UILabel *secondTitleLabel;
/// thirdLabel
@property (weak, nonatomic) UILabel *thirdLabel;
@property (weak, nonatomic) UILabel *thirdTitleLabel;
/// fourthLabel
@property (weak, nonatomic) UILabel *fourthLabel;
@property (weak, nonatomic) UILabel *fourthTitleLabel;
/// fifthLabel
@property (weak, nonatomic) UILabel *fifthLabel;
@property (weak, nonatomic) UILabel *fifthTitleLabel;
/// sixthLabel
@property (weak, nonatomic) UILabel *sixthLabel;
@property (weak, nonatomic) UILabel *sixthTitleLabel;

/// 水印
@property (weak, nonatomic) UIImageView *waterMarkImageView;

@end
@implementation SISSShowSixInfoView

- (void)setContentArr:(NSArray *)contentArr {
    _contentArr = contentArr;
    if (contentArr.count == 6) {
        self.firstLabel.text = ((NSString *)contentArr[0]).length > 0 ? contentArr[0] : @" ";
        self.secondLabel.text = ((NSString *)contentArr[1]).length > 0 ? contentArr[1] : @" ";
        self.thirdLabel.text = ((NSString *)contentArr[2]).length > 0 ? contentArr[2] : @" ";
        self.fourthLabel.text = ((NSString *)contentArr[3]).length > 0 ? contentArr[3] : @" ";
        self.fifthLabel.text = ((NSString *)contentArr[4]).length > 0 ? contentArr[4] : @" ";
        self.sixthLabel.text = ((NSString *)contentArr[5]).length > 0 ? contentArr[5] : @" ";
        
    }
}

- (void)setTitlesArr:(NSArray *)titlesArr {
    _titlesArr = titlesArr;
    if (titlesArr.count == 6) {
        self.firstTitleLabel.text = titlesArr[0];
        self.secondTitleLabel.text = titlesArr[1];
        self.thirdTitleLabel.text = titlesArr[2];
        self.fourthTitleLabel.text = titlesArr[3];
        self.fifthTitleLabel.text = titlesArr[4];
        self.sixthTitleLabel.text = titlesArr[5];
    }
}


- (void)setIsShowWaterMark:(BOOL)isShowWaterMark {
    _isShowWaterMark = isShowWaterMark;
    
    self.waterMarkImageView.hidden = !isShowWaterMark;
}


#pragma mark - UI
- (void)initUI {
    [super initUI];
    
    self.backgroundColor = COLOR(0xF1F1F5);
    
    UILabel *firstTitleLabel = [[UILabel alloc] init];
    firstTitleLabel.text = @"姓名：";
    firstTitleLabel.textColor = COLOR(0x8998A5);
    firstTitleLabel.font = [UIFont systemFontOfSize:16];
    firstTitleLabel.numberOfLines = 0;
    [self addSubview:firstTitleLabel];
    self.firstTitleLabel = firstTitleLabel;
    
    UILabel *firstLabel = [[UILabel alloc] init];
    firstLabel.text = @" ";
    firstLabel.textColor = MAIN_TEXT_COLOR;
    firstLabel.font = [UIFont boldSystemFontOfSize:16];
    firstLabel.numberOfLines = 0;
    [self addSubview:firstLabel];
    self.firstLabel = firstLabel;
    
    UILabel *secondTitleLabel = [[UILabel alloc] init];
    secondTitleLabel.text = @"身份证号：";
    secondTitleLabel.textColor = COLOR(0x8998A5);
    secondTitleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:secondTitleLabel];
    self.secondTitleLabel = secondTitleLabel;
    
    UILabel *secondLabel = [[UILabel alloc] init];
    secondLabel.text = @" ";
    secondLabel.textColor = MAIN_TEXT_COLOR;
    secondLabel.font = [UIFont boldSystemFontOfSize:16];
    secondLabel.numberOfLines = 0;
    [self addSubview:secondLabel];
    self.secondLabel = secondLabel;
    
    UILabel *thirdTitleLabel = [[UILabel alloc] init];
    thirdTitleLabel.text = @"产权证书类别：";
    thirdTitleLabel.textColor = COLOR(0x8998A5);
    thirdTitleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:thirdTitleLabel];
    self.thirdTitleLabel = thirdTitleLabel;
    
    UILabel *thirdLabel = [[UILabel alloc] init];
    thirdLabel.text = @" ";
    thirdLabel.textColor = MAIN_TEXT_COLOR;
    thirdLabel.font = [UIFont boldSystemFontOfSize:16];
    thirdLabel.numberOfLines = 0;
    [self addSubview:thirdLabel];
    self.thirdLabel = thirdLabel;
    
    UILabel *fourthTitleLabel = [[UILabel alloc] init];
    fourthTitleLabel.text = @"产权证书编号：";
    fourthTitleLabel.textColor = COLOR(0x8998A5);
    fourthTitleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:fourthTitleLabel];
    self.fourthTitleLabel = fourthTitleLabel;
    
    UILabel *fourthLabel = [[UILabel alloc] init];
    fourthLabel.text = @" ";
    fourthLabel.textColor = MAIN_TEXT_COLOR;
    fourthLabel.font = [UIFont boldSystemFontOfSize:16];
    fourthLabel.numberOfLines = 0;
    [self addSubview:fourthLabel];
    self.fourthLabel = fourthLabel;
    
    UILabel *fifthTitleLabel = [[UILabel alloc] init];
    fifthTitleLabel.text = @"共有权人姓名：";
    fifthTitleLabel.textColor = COLOR(0x8998A5);
    fifthTitleLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:fifthTitleLabel];
    self.fifthTitleLabel = fifthTitleLabel;
    
    UILabel *fifthLabel = [[UILabel alloc] init];
    fifthLabel.text = @" ";
    fifthLabel.textColor = MAIN_TEXT_COLOR;
    fifthLabel.font = [UIFont boldSystemFontOfSize:16];
    fifthLabel.numberOfLines = 0;
    [self addSubview:fifthLabel];
    self.fifthLabel = fifthLabel;
    
    UILabel *sixthTitleLabel = [[UILabel alloc] init];
    sixthTitleLabel.text = @"共有权人身份证号：";
    sixthTitleLabel.textColor = COLOR(0x8998A5);
    sixthTitleLabel.font = [UIFont systemFontOfSize:16];
    [sixthTitleLabel sizeToFit];
    [self addSubview:sixthTitleLabel];
    self.sixthTitleLabel = sixthTitleLabel;
    
    UILabel *sixthLabel = [[UILabel alloc] init];
    sixthLabel.text = @" ";
    sixthLabel.textColor = MAIN_TEXT_COLOR;
    sixthLabel.numberOfLines = 0;
    sixthLabel.font = [UIFont boldSystemFontOfSize:16];
    [self addSubview:sixthLabel];
    self.sixthLabel = sixthLabel;
    
    UIImageView *waterMarkImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dataWaterMark"]];
    [waterMarkImageView sizeToFit];
    waterMarkImageView.hidden = YES;
    [self addSubview:waterMarkImageView];
    
    self.waterMarkImageView = waterMarkImageView;
}

#pragma mark - 布局
- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGFloat margin = 8.0;
    [self.firstTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf).offset(margin);
        make.top.equalTo(weakSelf).offset(2 * margin);
    }];
    [self.firstLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.firstTitleLabel.mas_right);
        make.bottom.equalTo(weakSelf.firstTitleLabel);
    }];
    
    [self.secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.firstTitleLabel);
        make.top.equalTo(weakSelf.firstTitleLabel.mas_bottom).offset(2 * margin);
    }];
    [self.secondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.secondTitleLabel.mas_right);
        make.top.equalTo(weakSelf.secondTitleLabel);
    }];
    
    [self.thirdTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.secondTitleLabel);
        make.top.equalTo(weakSelf.secondLabel.mas_bottom).offset(2 * margin);
    }];
    [self.thirdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.thirdTitleLabel.mas_right);
        make.top.equalTo(weakSelf.thirdTitleLabel);
        make.right.equalTo(weakSelf).offset(-margin);
    }];
    
    [self.fourthTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.thirdTitleLabel);
        make.top.equalTo(weakSelf.thirdTitleLabel.mas_bottom).offset(2 * margin);
    }];
    [self.fourthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.fourthTitleLabel.mas_right);
        make.top.equalTo(weakSelf.fourthTitleLabel);
    }];
    
    [self.fifthTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.fourthTitleLabel);
        make.top.equalTo(weakSelf.fourthLabel.mas_bottom).offset(2 * margin);
    }];
    [self.fifthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.fifthTitleLabel.mas_right);
        make.top.equalTo(weakSelf.fifthTitleLabel);
        make.right.equalTo(weakSelf).offset(-margin).priority(999);
    }];
    
    [self.sixthTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.fifthTitleLabel);
        make.top.equalTo(weakSelf.fifthTitleLabel.mas_bottom).offset(2 * margin);
    }];
    [self.sixthLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.sixthTitleLabel.mas_right);
        make.top.equalTo(weakSelf.sixthTitleLabel);
        make.right.equalTo(weakSelf).offset(-margin).priority(999);
        make.bottom.equalTo(weakSelf).offset(-margin);
    }];
    
    [self.waterMarkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(weakSelf);
    }];
}


@end
